package com.cloud.sample.core.constant;

import com.cloud.sample.core.exception.DbException;

/**
 * @author gjy
 * @since 2021/12/2 0002
 */
public enum DataBaseErrorCode implements BaseErrorCode {

    DB_ERROR(500, "数据操作异常"),
    DB_INSERT_FAIL(501, "数据插入失败"),
    DB_UPDATE_FAIL(503, "数据更新失败"),
    DB_DELETE_FAIL(504, "数据删除失败");

    private Integer code;
    private String message;

    DataBaseErrorCode(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    @Override
    public boolean equals(Integer v) {
        return false;
    }

    @Override
    public Integer getCode() {
        return null;
    }

    @Override
    public String getMessage() {
        return null;
    }

    public void throwException(Object... param) {
        throw new DbException(this, param);
    }
}
